package com.allwees.bs.c.module.merchant.dto;

import com.allwees.bs.c.module.merchant.entity.StoreEntity;
import com.allwees.bs.c.module.product.dto.ProductDetailsDTO;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 店铺数据传输对象
 */
@Data
//@ApiModel(description = "商品返回包装对象")
public class StoreDTO implements Serializable {
//    @ApiModelProperty(value = "手动生成UUID， 主键")
    private String uuid;

//    @ApiModelProperty(value = "店铺类型")
    private Integer type;

//    @ApiModelProperty(value = "店铺名称")
    private String name;

//    @ApiModelProperty(value = "店铺描述")
    private String description;

//    @ApiModelProperty(value = "店铺头像")
    private String avatar;

//    @ApiModelProperty(value = "评分")
    private Float rating;

//    @ApiModelProperty(value = "收藏数")
    private Integer totalSales = 0;

//    @ApiModelProperty(value = "总销量")
    private Integer totalCollections = 0;

//    @ApiModelProperty(value = "新商品数量")
    private Integer totalNewProduct;

//    @ApiModelProperty(value = "创建时间")
    private Date createdAt;

//    @ApiModelProperty(value = "更新时间")
    private Date updatedAt;

//    @ApiModelProperty(value = "删除时间")
    private Date deletedAt;

//    @ApiModelProperty(value = "用户是否收藏该店铺")
    private Boolean userIsCollection = false;

//    @ApiModelProperty(value = "店铺推荐商品")
    private List<ProductDetailsDTO> recommendProducts;

    public StoreDTO() {
    }

    public StoreDTO(StoreEntity entity) {
    	this(entity, false);
    }

    public StoreDTO(StoreEntity entity, boolean fullMode) {
        this.setUuid(entity.getUuid());
        this.setType(entity.getType());
        this.setName(entity.getName());
        this.setDescription(entity.getDescription());
        this.setAvatar(entity.getAvatar());
        this.setRating(entity.getRating());
        this.setTotalCollections(entity.getTotalCollections());
        this.setTotalSales(entity.getTotalSales());
        this.setTotalNewProduct(entity.getTotalNewProduct());
        if(fullMode) {
            this.setCreatedAt(entity.getCreatedAt());
            this.setUpdatedAt(entity.getUpdatedAt());
            this.setDeletedAt(entity.getDeletedAt());
        }
    }
}
